import java.util.ArrayList;
public class Student {
    private String studentID;
    private String studentName;
    private int age;
    private ArrayList<Course> enrolledCourses;

    public Student(String studentID, String studentName, int age) {
        this.studentID = studentID;
        this.studentName = studentName;
        this.age = age;
        this.enrolledCourses = new ArrayList<>();
    }

    public Student(String studentID, String studentName) {
        this(studentID, studentName, 18); // Default age is set to 18
    }

    public void enrollInCourse(Course course) {
        enrolledCourses.add(course);
        course.enrollStudent(studentName);
    }

    public void printStudentInfo() {
        System.out.println("Student ID: " + studentID);
        System.out.println("Student Name: " + studentName);
        System.out.println("Age: " + age);
        System.out.println("Enrolled Courses: " + enrolledCourses.size());
    }

    public void dropCourse(Course course) {
        if (enrolledCourses.contains(course)) {
            enrolledCourses.remove(course);
            course.dropStudent(studentName);
        } else {
            System.out.println(studentName + " is not enrolled in " + course.getCourseName());
        }
    }

}
